package io.a.a

object practise1{
  def practise1(list: List[Int], n: Int): Double = {
    val filteredList = list.filter(_ < n)
    if (filteredList.isEmpty) {
      0
    } else {
      filteredList.sum.toDouble / filteredList.length.toDouble}
  }


  def main(args: Array[String]): Unit = {
    println(practise1(List(1, 3, 5, 7), 4) )
    println(practise1(List(1, 3, 5, 7), 6) )
  }
}
